package com.xuelang.pipeline.artifact.app.nexus3v1;

import com.xuelang.pipeline.artifact.app.nexus3v1.config.Nexus3v1UiFeignConfig;
import com.xuelang.pipeline.artifact.app.nexus3v1.fallback.WebhookRepositoryServiceFallbackFactory;
import com.xuelang.pipeline.artifact.app.nexus3v1.request.CreateWebhookRepositoryRequest;
import com.xuelang.pipeline.artifact.app.nexus3v1.request.RemoveWebhookRepositoryRequest;
import com.xuelang.pipeline.artifact.app.nexus3v1.response.CreateWebhookRepositoryResponse;
import com.xuelang.pipeline.artifact.app.nexus3v1.response.RemoveWebhookRepositoryResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import jakarta.validation.Valid;

/**
 * 封装NexusOSS 3.37.3-02以上安全-角色相关接口-对应Security management: roles
 *
 * @author xiwen.zxg
 * @since 2024/7/9
 */
@FeignClient(
        name = "webhook-repository-service",
        url = "${feign.rpc.nexus3V1UiService}",
        configuration = Nexus3v1UiFeignConfig.class,
        fallbackFactory = WebhookRepositoryServiceFallbackFactory.class)
public interface WebhookRepositoryCapabilityService {

    /**
     * 创建webhook-repository
     *
     * @param createWebhookRepositoryRequest
     * @return
     */

    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    CreateWebhookRepositoryResponse createCapability(@RequestBody @Valid CreateWebhookRepositoryRequest createWebhookRepositoryRequest);

    /**
     * 删除webhook-repository
     *
     * @param removeWebhookRepositoryRequest
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    RemoveWebhookRepositoryResponse removeCapability(@RequestBody @Valid RemoveWebhookRepositoryRequest removeWebhookRepositoryRequest);

}
